package com.dongdongshop.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdongshop.pojo.TbBrand;
import com.dongdongshop.pojo.TbContentCategory;
import com.dongdongshop.pojo.TbSpecification;
import com.dongdongshop.pojo.TbTypeTemplate;
import com.dongdongshop.service.*;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Description
 * @ClassName IndexController
 * @Author RC
 * @date 2020.12.09 19:31
 */
@Controller
public class IndexController {
    @Reference(timeout = 100000,check = false)
    private BrandService brandService;
    @Reference(timeout = 100000, check = false)
    private TbSpecificationService tbSpecificationService;
    @Reference(timeout = 100000,check = false)
    private TempLateService tempLateService;
    @Reference(timeout = 100000,check = false)
    private ContentCategoryService contentCategoryService;

    @RequestMapping({"index","/"})
    public String index(){
        return "admin/index";
    }

    @RequestMapping("home")
    public String home(){
        return "admin/home";
    }

    @RequestMapping("toBrand")
    public String brand(){

        return "admin/brand";
    }
    @RequestMapping("toSpecification")
    public String toSpecification(){

        return "admin/specification";
    }

    @RequestMapping("content_category")
    public String content_category(){

        return "admin/content_category";
    }

    @RequestMapping("content")
    public String content(Model model){
      List<TbContentCategory> contentCategory = contentCategoryService.getContentCategoryAllList();
      model.addAttribute("contentCagetory",contentCategory);
        return "admin/content";
    }

    @RequestMapping("goods")
    public String toGgoods(){

        return "admin/goods";
    }

    @RequestMapping("toTypeTemplate")
    public String toTypeTemplate(Model model){
        List<TbBrand> brandList = brandService.brandList();
        model.addAttribute("brandList",brandList);
        List<TbSpecification> tbSpecifications = tbSpecificationService.specificationList();
        model.addAttribute("specList",tbSpecifications);
        return "admin/type_template";
    }
    @RequestMapping("toItem_cat")
    public String toItem_cat(Model model){
        List<TbTypeTemplate> tempLateList = tempLateService.getTempLateList();
        model.addAttribute("tempLateList",tempLateList);
        return "admin/item_cat";
    }
    //商家管理
    @RequestMapping("seller")
    public String seller(){

        return "admin/seller";
    }
    //商家审核
    @RequestMapping("seller_1")
    public String seller_1(){

        return "admin/seller_1";
    }



}
